import { ApiPropertyOptional, PartialType } from '@nestjs/swagger';
import { CreateUseDbDto } from './create-use-db.dto';
import { IsNotEmpty, MinLength } from 'class-validator';

export class UpdateUseDbDto extends PartialType(CreateUseDbDto) {
  @IsNotEmpty({ message: 'id不能为空' })
  @ApiPropertyOptional({ description: '用户ID' })
  id: number;

  @ApiPropertyOptional({ description: '用户名' })
  @IsNotEmpty({ message: '用户名不能为空' })
  username: string;

  @ApiPropertyOptional({ description: '密码' })
  @IsNotEmpty({ message: '密码不能为空' })
  @MinLength(6, { message: '密码最少 6 位' })
  password: string;

  @ApiPropertyOptional({ description: '用户类型' })
  @IsNotEmpty({ message: '用户类型不能为空' })
  userType: number; //用户类型 0 管理员 1 普通用户

  @ApiPropertyOptional({ description: '邮箱' })
  @IsNotEmpty({ message: '邮箱不能为空' })
  email: string;

  @ApiPropertyOptional({ description: '头像' })
  avatar: string;

  @ApiPropertyOptional({ description: '用户描述' })
  desc: string;
}
